/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package nodeLevelMetaModel.impl;

import java.util.Collection;

import nodeLevelMetaModel.LeaderRole;
import nodeLevelMetaModel.NodeLevelMetaModelPackage;
import nodeLevelMetaModel.OperationalTask;
import nodeLevelMetaModel.ReceivingTask;
import nodeLevelMetaModel.SendingTask;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Leader Role</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link nodeLevelMetaModel.impl.LeaderRoleImpl#getName2 <em>Name2</em>}</li>
 *   <li>{@link nodeLevelMetaModel.impl.LeaderRoleImpl#getName3 <em>Name3</em>}</li>
 *   <li>{@link nodeLevelMetaModel.impl.LeaderRoleImpl#getName4 <em>Name4</em>}</li>
 *   <li>{@link nodeLevelMetaModel.impl.LeaderRoleImpl#getMemberIds <em>Member Ids</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LeaderRoleImpl extends RoleImpl implements LeaderRole {
	/**
	 * The cached value of the '{@link #getName2() <em>Name2</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName2()
	 * @generated
	 * @ordered
	 */
	protected EList<SendingTask> name2;

	/**
	 * The cached value of the '{@link #getName3() <em>Name3</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName3()
	 * @generated
	 * @ordered
	 */
	protected EList<ReceivingTask> name3;

	/**
	 * The cached value of the '{@link #getName4() <em>Name4</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName4()
	 * @generated
	 * @ordered
	 */
	protected OperationalTask name4;

	/**
	 * The cached value of the '{@link #getMemberIds() <em>Member Ids</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMemberIds()
	 * @generated
	 * @ordered
	 */
	protected EList<?> memberIds;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LeaderRoleImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return NodeLevelMetaModelPackage.Literals.LEADER_ROLE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<SendingTask> getName2() {
		if (name2 == null) {
			name2 = new EObjectResolvingEList<SendingTask>(SendingTask.class, this, NodeLevelMetaModelPackage.LEADER_ROLE__NAME2);
		}
		return name2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ReceivingTask> getName3() {
		if (name3 == null) {
			name3 = new EObjectResolvingEList<ReceivingTask>(ReceivingTask.class, this, NodeLevelMetaModelPackage.LEADER_ROLE__NAME3);
		}
		return name3;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public OperationalTask getName4() {
		if (name4 != null && name4.eIsProxy()) {
			InternalEObject oldName4 = (InternalEObject)name4;
			name4 = (OperationalTask)eResolveProxy(oldName4);
			if (name4 != oldName4) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodeLevelMetaModelPackage.LEADER_ROLE__NAME4, oldName4, name4));
			}
		}
		return name4;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public OperationalTask basicGetName4() {
		return name4;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName4(OperationalTask newName4) {
		OperationalTask oldName4 = name4;
		name4 = newName4;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, NodeLevelMetaModelPackage.LEADER_ROLE__NAME4, oldName4, name4));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<?> getMemberIds() {
		return memberIds;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMemberIds(EList<?> newMemberIds) {
		EList<?> oldMemberIds = memberIds;
		memberIds = newMemberIds;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, NodeLevelMetaModelPackage.LEADER_ROLE__MEMBER_IDS, oldMemberIds, memberIds));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME2:
				return getName2();
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME3:
				return getName3();
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME4:
				if (resolve) return getName4();
				return basicGetName4();
			case NodeLevelMetaModelPackage.LEADER_ROLE__MEMBER_IDS:
				return getMemberIds();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME2:
				getName2().clear();
				getName2().addAll((Collection<? extends SendingTask>)newValue);
				return;
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME3:
				getName3().clear();
				getName3().addAll((Collection<? extends ReceivingTask>)newValue);
				return;
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME4:
				setName4((OperationalTask)newValue);
				return;
			case NodeLevelMetaModelPackage.LEADER_ROLE__MEMBER_IDS:
				setMemberIds((EList<?>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME2:
				getName2().clear();
				return;
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME3:
				getName3().clear();
				return;
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME4:
				setName4((OperationalTask)null);
				return;
			case NodeLevelMetaModelPackage.LEADER_ROLE__MEMBER_IDS:
				setMemberIds((EList<?>)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME2:
				return name2 != null && !name2.isEmpty();
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME3:
				return name3 != null && !name3.isEmpty();
			case NodeLevelMetaModelPackage.LEADER_ROLE__NAME4:
				return name4 != null;
			case NodeLevelMetaModelPackage.LEADER_ROLE__MEMBER_IDS:
				return memberIds != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (memberIds: ");
		result.append(memberIds);
		result.append(')');
		return result.toString();
	}

} //LeaderRoleImpl
